/**
 * Created by Administrator on 2016/8/18.
 * 城市管理、房产管理、建筑行业、城建档案、建筑科技、美丽乡村、阳光征收、住房保障、物业管理
 */

var menus = [
    {id:1,name:"城市管理",
        items:[
            {url:"demo/common.html",item_name:"公共事业"},
            {url:"demo/common.html",item_name:"城市供水"},
            {url:"demo/common.html",item_name:"城市供气"},
            {url:"demo/common.html",item_name:"环境卫生"},
            {url:"demo/common.html",item_name:"园林绿化"}
        ]},
    {id:2,name:"房产管理",
        items:[
            {url:"demo/houses.html",item_name:"房源信息"},
            {url:"demo/common.html",item_name:"房产租赁"},
            {url:"demo/common.html",item_name:"房产企业"},
            {url:"demo/common.html",item_name:"开发项目信息"},
            {url:"demo/common.html",item_name:"开发合同信息"},
            {url:"demo/common.html",item_name:"市场运行情况"}
        ]},
    {id:3,name:"建筑行业",
        items:[
            {url:"demo/common.html",item_name:"公共事业"},
            {url:"demo/common.html",item_name:"城市供水"},
            {url:"demo/common.html",item_name:"城市供气"},
            {url:"demo/common.html",item_name:"环境卫生"},
            {url:"demo/common.html",item_name:"园林绿化"}
        ]},
    {id:4,name:"城建档案",
        items:[
            {url:"demo/common.html",item_name:"公共事业"},
            {url:"demo/common.html",item_name:"城市供水"},
            {url:"demo/common.html",item_name:"城市供气"},
            {url:"demo/common.html",item_name:"环境卫生"},
            {url:"demo/common.html",item_name:"园林绿化"}
        ]},
    {id:5,name:"建筑科技",
        items:[
            {url:"demo/common.html",item_name:"公共事业"},
            {url:"demo/common.html",item_name:"城市供水"},
            {url:"demo/common.html",item_name:"城市供气"},
            {url:"demo/common.html",item_name:"环境卫生"},
            {url:"demo/common.html",item_name:"园林绿化"}
        ]},
    {id:6,name:"美丽乡村",
        items:[
            {url:"demo/common.html",item_name:"公共事业"},
            {url:"demo/common.html",item_name:"城市供水"},
            {url:"demo/common.html",item_name:"城市供气"},
            {url:"demo/common.html",item_name:"环境卫生"},
            {url:"demo/common.html",item_name:"园林绿化"}
        ]},
    {id:7,name:"阳光征收",
        items:[
            {url:"demo/common.html",item_name:"公共事业"},
            {url:"demo/common.html",item_name:"城市供水"},
            {url:"demo/common.html",item_name:"城市供气"},
            {url:"demo/common.html",item_name:"环境卫生"},
            {url:"demo/common.html",item_name:"园林绿化"}
        ]},
    {id:8,name:"住房保障",
        items:[
            {url:"demo/common.html",item_name:"公共事业"},
            {url:"demo/common.html",item_name:"城市供水"},
            {url:"demo/common.html",item_name:"城市供气"},
            {url:"demo/common.html",item_name:"环境卫生"},
            {url:"demo/common.html",item_name:"园林绿化"}
        ]},
    {id:9,name:"物业管理",
        items:[
            {url:"demo/common.html",item_name:"公共事业"},
            {url:"demo/common.html",item_name:"城市供水"},
            {url:"demo/common.html",item_name:"城市供气"},
            {url:"demo/common.html",item_name:"环境卫生"},
            {url:"demo/common.html",item_name:"园林绿化"}
        ]},
    {id:10,name:"关于我们",
        items:[
            {url:"demo/common.html",item_name:"公共事业"},
            {url:"demo/common.html",item_name:"城市供水"},
            {url:"demo/common.html",item_name:"城市供气"},
            {url:"demo/common.html",item_name:"环境卫生"},
            {url:"demo/common.html",item_name:"园林绿化"}
        ]}
];

//根据数据设置菜单显示
(function(){
    var nav_menus = document.getElementById("top-nav-menus");
    var i=0;
    for (; i < menus.length; i++) {
        var menu = document.createElement("li");
        menu.setAttribute("class","dropdown");
        var a = document.createElement("a");
        a.setAttribute("href","#");
        a.setAttribute("class","dropdown-toggle");
        a.setAttribute("data-toggle","dropdown");
        a.setAttribute("role","button");
        a.setAttribute("aria-haspopup","ture");
        a.setAttribute("aria-expanded","false");
        a.innerHTML=menus[i].name;
        menu.appendChild(a);
        var ul = document.createElement("ul");
        ul.setAttribute("class","dropdown-menu");
        var j = 0;
        var items = menus[i].items;
        for(;j<items.length;j++){
            var menu1 = document.createElement("li");
            var a1 = document.createElement("a");
            a1.setAttribute("href",getRootPath()+"/"+items[j].url);
            a1.innerHTML=items[j].item_name;
            menu1.appendChild(a1);
            ul.appendChild(menu1);
        }
        menu.appendChild(ul);
        nav_menus.appendChild(menu);
    }
})();

